package com.glsc.ngateway.common.base.domain.mysql.gateway.other;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.time.LocalDateTime;

/**
 * @author libj
 * @date 2022/04/19
 * 交易单元租用流水表
 */
@Data
@Entity
@Table(name = "t_am_trade_seat_history")
@org.hibernate.annotations.Table(appliesTo = "t_am_trade_seat_history",comment = "交易单元租用流水表")
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class TradeSeatHistory {
    @ApiModelProperty(value = "交易单元ID")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "trade_seat_id")
    private Integer tradeSeatId;

    @ApiModelProperty(value = "交易单元号")
    @Column(name = "trade_seat_code", columnDefinition = "varchar(10) COMMENT '交易单元号'")
    private String tradeSeatCode;

    @ApiModelProperty(value = "市场 字典: am_trade_seat_market")
    @Column(name = "trade_seat_market", columnDefinition = "varchar(10) COMMENT '市场 字典: am_trade_seat_market'")
    private String tradeSeatMarket;

    @ApiModelProperty(value = "交易单元类型 字典: am_trade_seat_use_type")
    @Column(name = "use_type", columnDefinition = "varchar(10) COMMENT '交易单元类型 字典: am_trade_seat_use_type'")
    private String useType;

    @ApiModelProperty(value = "使用机构ID")
    @Column(name = "use_company_id", columnDefinition = "varchar(100) COMMENT '使用机构ID'")
    private String useCompanyId;

    @ApiModelProperty(value = "使用机构")
    @Column(name = "use_company_name", columnDefinition = "varchar(100) COMMENT '使用机构'")
    private String useCompanyName;

    @ApiModelProperty(value = "使用说明")
    @Column(name = "use_desc", columnDefinition = "text COMMENT '使用说明'")
    private String useDesc;

    @ApiModelProperty(value = "申请部门ID")
    @Column(name = "apply_dept_id", columnDefinition = "int(11) COMMENT '申请部门ID'")
    private Integer applyDeptId;

    @ApiModelProperty(value = "申请部门")
    @Column(name = "apply_dept_name", columnDefinition = "varchar(100) COMMENT '申请部门'")
    private String applyDeptName;

    @ApiModelProperty(value = "费用承担部门ID（不分摊）")
    @Column(name = "expense_dept_id", columnDefinition = "int(11) COMMENT '费用承担部门ID（不分摊）'")
    private Integer expenseDeptId;

    @ApiModelProperty(value = "费用承担部门（不分摊）")
    @Column(name = "expense_dept_name", columnDefinition = "varchar(100) COMMENT '费用承担部门（不分摊）'")
    private String expenseDeptName;

    @ApiModelProperty(value = "分摊原则（分摊）")
    @Column(name = "expense_desc", columnDefinition = "varchar(500) COMMENT '分摊原则（分摊）'")
    private String expenseDesc;

    @ApiModelProperty(value = "交易单元状态 字典: am_trade_seat_state")
    @Column(name = "state", columnDefinition = "varchar(10) COMMENT '交易单元状态 字典: am_trade_seat_state'")
    private String state;

    @ApiModelProperty(value = "OA流程")
    @Column(name = "oa_request_id", columnDefinition = "varchar(100) COMMENT 'OA流程'")
    private String oaRequestId;

    @ApiModelProperty(value = "纸质版申请")
    @Column(name = "offline_apply", columnDefinition = "varchar(100) COMMENT '纸质版申请'")
    private String offlineApply;

    @ApiModelProperty(value = "开通时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "begin_date", columnDefinition = "varchar(10) COMMENT '开通时间'")
    private String beginDate;

    @ApiModelProperty(value = "停用时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "end_date", columnDefinition = "varchar(10) COMMENT '停用时间'")
    private String endDate;

    @ApiModelProperty(value = "申请人ID")
    @Column(name = "applicant_account", columnDefinition = "varchar(50) COMMENT '申请人ID'")
    private String applicantAccount;

    @ApiModelProperty(value = "申请类型")
    @Column(name = "apply_type", columnDefinition = "varchar(50) COMMENT '申请类型'")
    private String applyType;

    @ApiModelProperty(value = "申请类型编码")
    @Column(name = "apply_type_code", columnDefinition = "int(11) COMMENT '申请类型编码'")
    private Integer applyTypeCode;

    @ApiModelProperty(value = "变更类型")
    @Column(name = "change_type", columnDefinition = "varchar(100) COMMENT '变更类型'")
    private String changeType;

    @ApiModelProperty(value = "变更类型编码")
    @Column(name = "change_type_code", columnDefinition = "int(11) COMMENT '变更类型编码'")
    private Integer changeTypeCode;

    @ApiModelProperty(value = "申请时间")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "apply_date", columnDefinition = "varchar(10) COMMENT '申请时间'")
    private String applyDate;

    @ApiModelProperty(value = "申请说明")
    @Column(name = "apply_desc", columnDefinition = "text COMMENT '申请说明'")
    private String applyDesc;

    @ApiModelProperty(value = "交易单元数据来源 字典: am_trade_seat_source")
    @Column(name = "data_source", columnDefinition = "varchar(10) COMMENT '交易单元数据来源 字典: am_trade_seat_source'")
    private String dataSource;

    @ApiModelProperty(value = "批次Id")
    @Column(name = "import_key", columnDefinition = "text COMMENT '批次Id'")
    private String importKey;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'",updatable = false)
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime createTime;

    @ApiModelProperty(value = "创建人ID")
    @Column(name = "create_operator", columnDefinition = "varchar(20) COMMENT '创建人ID'")
    private String createOperator;

    @ApiModelProperty(value = "创建人姓名")
    @Column(name = "create_operator_name", columnDefinition = "varchar(20) COMMENT '创建人姓名'")
    protected String createOperatorName;

    //操作人员信息
    @ApiModelProperty(value = "操作来源")
    @Column(name = "op_source", columnDefinition = "varchar(32) COMMENT '操作来源'")
    private String opSource;

    @ApiModelProperty(value = "操作动作(增加、修改)")
    @Column(name = "op_action", columnDefinition = "varchar(32) COMMENT '操作动作(增加、修改)'")
    private String opAction;

    @ApiModelProperty(value = "操作人员ID")
    @Column(name = "op_operator", columnDefinition = "varchar(20) COMMENT '操作人员ID'")
    protected String opOperator;

    @ApiModelProperty(value = "操作人员姓名")
    @Column(name = "op_operator_name", columnDefinition = "varchar(20) COMMENT '操作人员姓名'")
    private String opOperatorName;

    @ApiModelProperty(value = "操作时间")
    @Column(name = "op_time", columnDefinition = "datetime comment '操作时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    private LocalDateTime opTime;
}
